package com.gupaoedu.vip.netty.io.bio.tomcat.http;

/**
 * @program:gupaoedu-vip-netty-io
 * @description:仿HttpServlet
 * @author:Gongchao
 * @date:2020-04-26
 **/
public abstract class GPServlet {

    public abstract void doGet(GPRequest gpRequest,GPResponse gpResponse) throws Exception;

    public abstract void doPost(GPRequest gpRequest,GPResponse gpResponse) throws Exception;

    public void service(GPRequest gpRequest,GPResponse gpResponse) throws Exception {
        if("GET".equalsIgnoreCase(gpRequest.getMethod())) {
            doGet(gpRequest,gpResponse);
        }else {
            doPost(gpRequest,gpResponse);
        }

    }

}
